package com.easyctrl.dialog;

import com.easyctrl.ldy.activity.MainApplication;
import com.easyctrl.ldy.activity.R;
import com.easyctrl.ui.base.BaseDialog;

import android.content.Context;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class AppErrorDialog extends BaseDialog implements OnClickListener{

	private TextView errorlog; 
	
	private static AppErrorDialog instance;
	public static AppErrorDialog getInstance(Context context){
		if(instance == null){
			instance = new AppErrorDialog(context);
		}
		return instance;
	}
	
	public AppErrorDialog(Context context) {
		super(context); 
		setContentView(R.layout.app_error_dialog);
		errorlog = (TextView) findViewById(R.id.errorlog);
		findViewById(R.id.confirm).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) { 
		if(v.getId() == R.id.confirm){
			
			 MainApplication.exitApp.exit();
			 android.os.Process.killProcess(android.os.Process.myPid());  
	         System.exit(10);  
		}
	}
	
	public void setErroeMessage(String errMsg){
		errorlog.setText(Html.fromHtml(errMsg));
	}
	
	@Override
	public void show() { 
		super.show();
	}
}
